package com.pucong.gitee.database.backup.business.service.util.fileService;

import com.pucong.gitee.database.backup.common.entity.service.ServiceFile;
import com.pucong.gitee.database.backup.common.selfenum.ServiceFileType;

public class FileOperationServiceFactory {

    /**
     * 工厂生产
     * @param serviceFile
     * @return
     */
    public static FileOperationService getFileService(String sessionId, ServiceFile serviceFile) {
        ServiceFileType serviceFileType = serviceFile.getServiceFileType();
        FileOperationService fileOperationService = null;
        switch (serviceFileType) {
            case FTP:
                fileOperationService = new FileOperationServiceFtpImpl(sessionId, serviceFile);
                break;
            case SFTP:
                fileOperationService = new FileOperationServiceSftpImpl(sessionId, serviceFile);
                break;
        }
        return fileOperationService;
    }

}